﻿var ScrambledEggs;
(function (ScrambledEggs) {
    (function (Modules) {
        var Inventory = (function () {
            function Inventory() {
            }
            Inventory.prototype.initialize = function (gameState, onUpdate) {
                this._onUpdate = onUpdate;
            };
            Inventory.prototype.update = function (gameState, triggerSource) {
                if(!gameState.State.Inventory["PenKey"]) {
                    $("#inventory").hide();
                    return;
                }
                var me = this;
                var inventory = $("#inventory").show();
                inventory.find("section").remove();
                for(var itemKey in gameState.State.Inventory) {
                    var status = gameState.State.Inventory[itemKey];
                    switch(itemKey) {
                        case "PenKey":
                            if(status == 1) {
                                inventory.append("<section title=\"It's a key!\">&nbsp;/¨¨¨\\_______<br />|&nbsp;o&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_&nbsp;&nbsp;&nbsp;&nbsp;`.<br />&nbsp;\\___~^-´&nbsp;`^¨\"´</section>");
                            }
                            if(status == -1) {
                                inventory.append("<section title=\"An unidentified Object.\">&nbsp;&nbsp;???&nbsp;&nbsp;</section>");
                            }
                            break;
                        default:
                            throw "Cannot display item of type " + itemKey;
                    }
                }
                inventory.find("div").appendTo(inventory);
            };
            return Inventory;
        })();
        Modules.Inventory = Inventory;        
    })(ScrambledEggs.Modules || (ScrambledEggs.Modules = {}));
    var Modules = ScrambledEggs.Modules;
})(ScrambledEggs || (ScrambledEggs = {}));
